﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LeMigue.Scrum.TfsScrumV1.Utils
{
    public class TfsQueryLinkItem : TfsQuery
    {
        public enum Mode
        {
            MustContain
        }

        private static WorkItemFields[] QuerySelect = new WorkItemFields[]{
                WorkItemFields.Id
            };

        private Mode _modo = Mode.MustContain;

        public TfsQueryLinkItem(WorkItemFields[] fields, Mode modo, int idSource) 
            : base(TfsTable.WorkItemLinks, fields.Concat(QuerySelect).ToArray()) 
        {
            _modo = modo;
            this.AppendWhere(WorkItemFields.SourceId,"=",idSource);
        }

        private string Modo
        {
            get
            {
                if (_modo == Mode.MustContain)
                    return "mustcontain";

                return "mustcontain";
            }
        }

        public override string ToString()
        {
            return String.Format("{0} mode({1})", base.ToString(), Modo);
        }
    }
}
